﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Windows;

namespace WebMiddleware
{
    public class WpfApplication : Application
    {
        private IServiceProvider _services;

        public WpfApplication(IServiceProvider services)
        {
            _services = services;
        }

        protected override void OnStartup(StartupEventArgs e)
        {
            var mainWindow = _services.GetRequiredService<IMainWindow>();
            this.MainWindow = mainWindow as Window;
            this.MainWindow?.Show();
            base.OnStartup(e);
        }
    }
}
